﻿@{
    //success messages
    var successMessages = new List<string>();
    if (TempData[string.Format("IT.CMS.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(TempData[string.Format("IT.CMS.notifications.{0}", NotifyType.Success)] as IList<string>);
    }
    if (ViewData[string.Format("IT.CMS.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.AddRange(ViewData[string.Format("IT.CMS.notifications.{0}", NotifyType.Success)] as IList<string>);
    }


    //error messages
    var errorMessages = new List<string>();
    if (TempData[string.Format("IT.CMS.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(TempData[string.Format("IT.CMS.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
    if (ViewData[string.Format("IT.CMS.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.AddRange(ViewData[string.Format("IT.CMS.notifications.{0}", NotifyType.Error)] as IList<string>);
    }
}
@if (successMessages.Count > 0)
{
    var successSb = new System.Text.StringBuilder();
    for (int i = 0; i < successMessages.Count; i++)
    {
        successSb.Append(successMessages[i]);
        if (i != successMessages.Count - 1)
        {
            successSb.Append("\\n");
        }
    }
    <script type="text/javascript">
        $(document).ready(function () {
            alert('@Html.Raw(successSb.ToString())');
        });
    </script>
}
@if (errorMessages.Count > 0)
{
    var errorsSb = new System.Text.StringBuilder();
    for (int i = 0; i < errorMessages.Count; i++)
    {
        errorsSb.Append(errorMessages[i]);
        if (i != errorMessages.Count - 1)
        {
            errorsSb.Append("\\n");
        }
    }
    <script type="text/javascript">
        $(document).ready(function () {
            alert('@Html.Raw(errorsSb.ToString())');
        });
    </script>
}
@Html.Widget("mobile_notifications")